<template>

    <div class="box">
        <div class="header">
            <van-nav-bar title="详情" left-text="" left-arrow @click="$router.back()" />
        </div>
        <div class="meddle">
            <div>
                <img :src="obj.image" alt="">
                <p>{{ obj.title }}</p>
                <p style="color: red;">￥{{ obj.price }}</p>
            </div>
        </div>
        <van-action-bar class="kk">
            <van-action-bar-icon icon="chat-o" text="客服" dot />
            <van-action-bar-icon icon="cart-o" text="购物车" badge="5" @click="$router.push('/shop')" />
            <van-action-bar-icon icon="shop-o" text="店铺" badge="12" />
            <van-action-bar-button type="warning" text="加入购物车" @click="addcart"/>
            <van-action-bar-button type="danger" text="立即购买" />
        </van-action-bar>
    </div>
</template>
<script setup>
import request from '@/utils/request.js'
import { ref, onMounted } from "vue";
import { useCounterStore } from '@/stores/counter'
const store = useCounterStore()
const obj = ref([])
import { useRoute, useRouter } from 'vue-router'
const router = useRouter()
const addcart=ref()
const route = useRoute()
onMounted(() => {
    request.get('/detail', {
        params: {
            id: route.params.id
        }
    }).then(res => {
        if (res.data.code == 200) {
            obj.value = res.data.data
        }
    })

})


</script>
<style lang="scss" scoped>

    *{
        padding: 0;
        margin: 0;
        list-style: none;
    }
    .kk{
        height: 20%;
    }
</style>